<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>报关单登记系统</title>
<style type="text/css">
  .base{
    padding:8px;
  }
  .baseCenter{
    left:50%;
    margin-left:-10.5cm;
    width:21.3cm;
    position:relative;
  }
  .baseBlock{
    left:50%;
    margin-left:-10.5cm;
    width:21.3cm;
    height:30cm;
    position:relative;
  }
</style>
<!--[if IE]>
<style type="text/css">
  .baseBlockIn{
    top:8px;
    left:8px;
  }
  .ieShadow{
    filter:progid:DXImageTransform.Microsoft.Blur(pixelradius=8);
    -ms-filter:"progid:DXImageTransform.Microsoft.Blur(pixelradius=8)";
    background-color:#000;
    position:relative;
  }
</style>
<![endif]-->
<!--#include file="lib/js-google-analytics.asp"-->
</head>
<body>
<div class="cdframe">
<%
if not CheckFlag(session("aaPostFlag"),2) then call JumpErrorPage(2)
id=saferequest("id",1)
rcd=saferequest("rcd",0)
set rs=Server.CreateObject("ADODB.Recordset")
sql="select cd_no from cd where id="&id
if CheckWtr() then sql=sql&" and wtr="&session("iWtr")
' response.write(sql)
rs.open sql,conn,1,1
if not rs.eof then
  if rcd<>"no" then call SimpleRecord("pdffile",id,"查看","成功",session("iId"),session("iClientId"),false)
  call ShowFile(rs("cd_no"))
else
  if rcd<>"no" then call SimpleRecord("pdffile",id,"查看","失败",session("iId"),session("iClientId"),false)
  call JumpErrorPage(2)
end if
rs.close
set rs=nothing

function ShowFile(cd_no)
  dim sign,fs,cd_file
  sign=1
  Set fs=Server.CreateObject("Scripting.FileSystemObject")
  cd_file=Server.MapPath(".")&"\file\pdf\"&cd_no&"."&sign&".pdf"
  ' cd_box=Server.MapPath(".")&"\file\pdf\"&cd_no&".box.pdf"
  ' Response.Write(cd_file)
  If Not fs.FileExists(cd_file) then 
    Response.Write("原始报关单未保存在系统中")
  else
    Response.Write("<div class='base'><div class='baseCenter'><a href='file.asp?id="&id&"'>转到Web版</a>&nbsp;&nbsp;&nbsp;<a href='file/pdf/"&cd_no&".pdf'>下载完整PDF文件</a></div></div>")
    Do While fs.FileExists(cd_file)
    Response.Write("<div class='base'><div class='baseBlock'><embed type='application/pdf' width='100%' height='100%' src='file/pdf/"&cd_no&"."&sign&".pdf#toolbar=0&navpanes=0&scrollbar=0"&"'></embed></div></div>")
    sign=sign+1
    cd_file=Server.MapPath(".")&"\file\pdf\"&cd_no&"."&sign&".pdf"
    Loop
    ' If fs.FileExists(cd_box) then Response.Write("<div class='base'><div class='baseBlock'><embed type='application/pdf' width='100%' height='100%' src='file/pdf/"&cd_no&".box.pdf#toolbar=0&navpanes=0&scrollbar=0"&"'></embed></div></div>")
  end if
  set fs=nothing
end function
%>
</div>
</body>
</html>
<!--#include file="lib/connclose.asp"-->

